<?php

/**
 * Created by PhpStorm.
 * User: yuanluke
 * Date: 4/25/16
 * Time: 10:22
 */

namespace App\Http\Utils\Common;

use DB;

class LogUtils{

    public static function log2File($msg) {
        error_log('['.date('Y-m-d H:i:s').'] '.$msg.'\n', 3, '/var/tmp/facemeng.log');
    }


    public static function sqlLog() {
        $queries = DB::getQueryLog();
        $a = end($queries);
        $tmp = str_replace('?', '""'.'%s'.'""', $a['query']);
        return vsprintf($a['query'], $a['bindings']);
    }

}